package com.topfinance.cnaps2.util;

import java.lang.reflect.Method;
import java.util.Hashtable;

import javax.persistence.Table;

public class MsgFactory {
	public static final Object IBPS_TYPES[][] = new Object[][] {
			{ "node", com.topfinance.payment.ebo.TCfgNodeEbo.class,
				com.topfinance.payment.ebo.TCfgNodeEbo.class.getAnnotation(Table.class).name(),
				com.topfinance.payment.ebo.TCfgNodeEbo.class.getMethods() },
			{ "ibps.101.001.01", com.topfinance.ebo.msg.Ibps10100101.class,
					com.topfinance.ebo.msg.Ibps10100101.class.getAnnotation(Table.class).name(),
					com.topfinance.ebo.msg.Ibps10100101.class.getMethods() },
			{ "ibps.102.001.01", com.topfinance.ebo.msg.Ibps10200101.class,
					com.topfinance.ebo.msg.Ibps10200101.class.getAnnotation(Table.class).name(),
					com.topfinance.ebo.msg.Ibps10200101.class.getMethods() },
			{ "ibps.103.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps103.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps103.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps103.class.getMethods() },
			{ "ibps.104.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps104.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps104.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps104.class.getMethods() },
			// {"ibps.105.001.01",com.topfinance.cnaps2.ebo.msg.ibps.Ibps105.class},
			{ "ibps.106.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps106.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps106.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps106.class.getMethods() },
			{"ibps.303.001.01",com.topfinance.cnaps2.ebo.msg.ibps.Ibps303.class,
						com.topfinance.cnaps2.ebo.msg.ibps.Ibps303.class.getAnnotation(Table.class).name(),
						com.topfinance.cnaps2.ebo.msg.ibps.Ibps303.class.getMethods() },
			{ "ibps.305.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps305.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps305.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps305.class.getMethods() },
			{ "ibps.306.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps306.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps306.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps306.class.getMethods() },
			{ "ibps.307.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps307.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps307.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps307.class.getMethods() },
			{ "ibps.308.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps308.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps308.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps308.class.getMethods() },
			{ "ibps.309.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps309.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps309.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps309.class.getMethods() },
			// {"ibps.310.001.01",com.topfinance.cnaps2.ebo.msg.ibps.Ibps310.class},
			{ "ibps.331.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps331.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps331.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps331.class.getMethods() },
			{ "ibps.332.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps332.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps332.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps332.class.getMethods() },
			{ "ibps.333.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps333.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps333.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps333.class.getMethods() },
			{ "ibps.334.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps334.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps334.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps334.class.getMethods() },
			{ "ibps.335.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps335.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps335.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps335.class.getMethods() },
			{ "ibps.336.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps336.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps336.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps336.class.getMethods() },
			{ "ibps.337.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps337.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps337.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps337.class.getMethods() },
			{ "ibps.338.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps338.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps338.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps338.class.getMethods() },
			{ "ibps.339.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps339.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps339.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps339.class.getMethods() },
			{ "ibps.340.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps340.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps340.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps340.class.getMethods() },
			{ "ibps.341.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps341.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps341.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps341.class.getMethods() },
			{ "ibps.342.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps342.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps342.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps342.class.getMethods() },
			{ "saps.601.001.01", com.topfinance.ebo.msg.Saps60100101.class,
					com.topfinance.ebo.msg.Saps60100101.class.getAnnotation(Table.class).name(),
					com.topfinance.ebo.msg.Saps60100101.class.getMethods() },
			{ "saps.603.001.01", com.topfinance.cnaps2.ebo.msg.saps.Saps603.class,
					com.topfinance.cnaps2.ebo.msg.saps.Saps603.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.saps.Saps603.class.getMethods() },
			{ "saps.605.001.01", com.topfinance.cnaps2.ebo.msg.saps.Saps605.class,
					com.topfinance.cnaps2.ebo.msg.saps.Saps605.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.saps.Saps605.class.getMethods() },
			{ "ibps.701.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps701.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps701.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps701.class.getMethods() },
			{ "ibps.703.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps703.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps703.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps703.class.getMethods() },
			{ "ibps.704.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps704.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps704.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps704.class.getMethods() },
			{ "ibps.705.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps705.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps705.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps705.class.getMethods() },
			{ "ibps.706.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps706.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps706.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps706.class.getMethods() },
			{ "ccms.801.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms801.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms801.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms801.class.getMethods() },
			{ "ccms.803.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms803.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms803.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms803.class.getMethods() },
			{ "ccms.805.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms805.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms805.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms805.class.getMethods() },
			{ "ccms.806.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms806.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms806.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms806.class.getMethods() },
			{ "ccms.807.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms807.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms807.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms807.class.getMethods() },
			{ "ccms.809.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms809.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms809.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms809.class.getMethods() },
			{ "ccms.900.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms900.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms900.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms900.class.getMethods() },
			{ "ibps.901.001.01", com.topfinance.cnaps2.ebo.msg.ibps.Ibps901.class,
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps901.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ibps.Ibps901.class.getMethods() },
			{ "ccms.903.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms903.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms903.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms903.class.getMethods() },
			{ "ccms.905.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms905.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms905.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms905.class.getMethods() },
			{ "ccms.907.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms907.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms907.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms907.class.getMethods() },
			{ "ccms.909.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms909.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms909.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms909.class.getMethods() },
			{ "ccms.990.001.01", com.topfinance.cnaps2.ebo.msg.ccms.Ccms990.class,
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms990.class.getAnnotation(Table.class).name(),
					com.topfinance.cnaps2.ebo.msg.ccms.Ccms990.class.getMethods() } };

	private static MsgFactory instance = null;

	private static Hashtable msgTypes = new Hashtable();
	private static Hashtable msgTables = new Hashtable();
	private static Hashtable msgMethods = new Hashtable();

	public static MsgFactory getInstance() throws Exception {
		if (instance == null) {
			instance = new MsgFactory();
			instance.initArray();
		}
		return instance;
	}

	private static void initArray() throws Exception {
		for (int i = 0; i < IBPS_TYPES.length; i++) {
			msgTypes.put(IBPS_TYPES[i][0], IBPS_TYPES[i][1]);
			msgTables.put(IBPS_TYPES[i][0], IBPS_TYPES[i][2]);
			msgMethods.put(IBPS_TYPES[i][0], IBPS_TYPES[i][3]);
		}
	}

	public static Class getMsgPkg(String type) {
		return (Class) msgTypes.get(type);
	}
	public static String getMsgTable(String type) {
		return (String) msgTables.get(type);
	}
	public static Method[] getMsgMethods(String type) {
		return (Method[]) msgMethods.get(type);
	}
}
